function getCycleCount(a) {
    var b=1, tmp1, tmp2, tmp3, count=0, flag=[];
    while(1) {
        b = b*10;
        tmp1 = b%a;
        count++;
        if(tmp1==0) return 0;
        if(tmp1==1) return count;
        if(flag[tmp1]) return count;
        flag[tmp1]=1;
        b = tmp1;
    }    
}

function pe26(limit) {
    var maxLoop = 0;
    for(var i=1; i<=limit; i++) {
        var num = getCycleCount(i);
        if(num > maxLoop) {
            maxLoop = num;
            print("1/"+i+ "..." +num)            
        }
    }  
}

pe26(1000);

